
runOnStartup(async runtime => {
        runtime.getLayout("森林-测试场景").addEventListener("beforelayoutstart", () => doinit())
        runtime.addEventListener("tick", () => tick());

});


export function doinit() {

        playerSpwn.init()
}


export function tick() {
        playerSpwn.tick()

}

class playerSpwn {


        static init() {

                this.playeSpwninSpwnPoint()
                
        }

        static tick() {

        }

        static playeSpwninSpwnPoint() {

                /**
                 * 检测 是否有坐标点 
                 */

                const SpwanPoint = runtime.objects.PlayerSpwnPoint.getFirstInstance()
                if (SpwanPoint == null) { return }

                const player = runtime.objects.Player.getFirstInstance()
                if (player == null) { return }

                player.x = SpwanPoint.x
                player.y = SpwanPoint.y

                console.log("already set player position to spwnPoint ")





        }

}

export default playerSpwn;